Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow canceling drag-to-zoom on Escape key #672

Merged
merged 1 commit into from
Nov 23, 2022
Merged

Conversation

joshkel
Copy link
Contributor

@joshkel joshkel commented Sep 1, 2022

This makes the behavior of drag-to-zoom closer to the browser's standard drag-and-drop behavior.

This makes the behavior of drag-to-zoom closer to the browser's standard drag-and-drop behavior.
Copy link
Member

@kurkle kurkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention this in docs?

@stockiNail
Copy link
Contributor

stockiNail commented Oct 13, 2022

@joshkel do you think it could make sense to have an option (i.e., cancelKey) in the drag options where the user can decide which key should be pressed to cancel the dragging, instead of Escape only?

EDIT: default is Escape.

@kurkle
Copy link
Member

kurkle commented Nov 23, 2022

@joshkel do you think it could make sense to have an option (i.e., cancelKey) in the drag options where the user can decide which key should be pressed to cancel the dragging, instead of Escape only?

EDIT: default is Escape.

I think this can be added when another key is requested.

@kurkle kurkle merged commit ddc717d into chartjs:master Nov 23, 2022
@stockiNail
Copy link
Contributor

@joshkel do you think it could make sense to have an option (i.e., cancelKey) in the drag options where the user can decide which key should be pressed to cancel the dragging, instead of Escape only?
EDIT: default is Escape.

I think this can be added when another key is requested.

Ok for me! Probably I will need in my project but not now

@joshkel joshkel deleted the esc-key branch June 12, 2023 15:59
@cammytang
Copy link

Hey @kurkle, what should I do if I want to cancel drag-to-zoom on shift key released. I want to handle it similarly to the ESC key keydown scenario. shift is the modifierKey in my options. See

      drag: {
                        enabled: true,
                        modifierKey: 'shift',
                 }

I can't get or set the dragStart & dragEnd as they are inner props.
Could you give some advice? This problem has troubled me for a while. Thanks so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants